package bTree.LeetCode;

public class 最大升序子数组和 {
    public int maxAscendingSum(int[] nums) {
        int len=nums.length;
        int maxSum=0;
        int []dp=new int[len+1];
        dp[1]=nums[0];
        for(int i=2;i<len;i++){
            if(nums[i-1]>nums[i-2]){
                dp[i]=dp[i-1]+nums[i-1];
            }else {
                dp[i]=nums[i-1];
            }
            maxSum=Math.max(maxSum,dp[i]);
        }
        return maxSum;
    }
}